<% unless @okr.nil? %>

    <div class="right options">
      <% if can? :cru, @okr %>
          <a href="#" data-options="align:left" data-dropdown="drop1" class="dropdown right">
            <div class="icon settings-link"></div>
          </a>
          <ul id="drop1" data-dropdown-content class="f-dropdown">
            <li>
              <%= link_to "Edit", edit_user_okr_path(@user, @okr) %>
            </li>
            <% if can? :destroy, @okr %>
                <li>
                  <%= link_to "Delete", okr_path(@okr), :method => :delete, :confirm => 'Are you sure you want to archive this project?' %>
                </li>
            <% end %>
          </ul>
      <% end %>
      <div class="okr-approval right okr-approval-<%= @okr.id %>">
        <% if ((can? :destroy, @okr) && !@okr.approved) %>
            <%= button_to 'Approve', approve_user_okr_path(@okr.user_id, @okr), :remote => true, :class => 'btn btn-sec' %>
        <% elsif (can? :cru, @okr) %>
            <%= @okr.approved ? raw("<div class='verified'><div class='icon verified'></div><div class='text'>Verified</div></div>") : raw("<div class='unverified'><div class='icon unverified'></div><div class='text'>Not verified</div></div>") %>
        <% end %>
      </div>
    </div>
    <br/>
    <div class="okr-details">
      <div class="name"><%= @okr.name %></div>
      <div class="period"><%= "#{@okr.start_date.strftime('%d %B %Y')} - #{@okr.end_date.strftime('%d %B %Y')}" %></div>
    </div>

    <ol class="objectives">
      <% @okr.objectives.each_with_index do |o, i| %>
          <li><%= o.name %></li>
          <!--<div class="key-results">-->
          <ol class="key_results">
            <% o.key_results.each_with_index do |kr, j| %>
                <li><%= kr.name %></li>
            <% end %>
          </ol>
      <% end %>
    </ol>


    <!--<table class="table">-->
    <!--<thead>-->
    <!--<tr>-->
    <!--<th width="100">Sl no</th>-->
    <!--<th width="450">Objective</th>-->
    <!--<th width="450">Key results</th>-->
    <!--</tr>-->
    <!--</thead>-->
    <!--<tbody>-->
    <!--<%# @okr.objectives.each_with_index do |o, i| %>-->
    <!--<tr class="objective">-->
    <!--<td rowspan="<%#= o.key_results.count %>"><%#= i+1 %></td>-->
    <!--<td rowspan="<%#= o.key_results.count %>"><%#= o.name %></td>-->
    <!--<div class="key-results">-->
    <!--<%# o.key_results.each_with_index do |kr, j| %>-->
    <!--<td><%#= "#{j+1}. #{kr.name}" %></td>-->
    <!--<%# unless j ==0 %>-->
    <!--</tr>-->
    <!--<%# end %>-->
    <!--<tr>-->
    <!--<%# end %>-->
    <!--</tr>-->
    <!--</div>-->
    <!--</tr>-->
    <!--<%# end %>-->
    <!--</tbody>-->
    <!--</table>-->
<% end %>

<script type="text/javascript">
    $('.okr.card').removeClass('active')
    $('.okr-<%= @okr.try(&:id) %>').addClass('active')
</script>
